/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package soundscovery;

import java.util.Vector;

/**
 *
 * @author Administrator
 */
public class AllSounds {

    public Vector<Sound> sounds;

    AllSounds()
    {

    }
    AllSounds(String[] soundFilenames)
    {
        sounds = new Vector<Sound>();
        for(int i=0;i<soundFilenames.length; i++)
        {
            sounds.add(new Sound(soundFilenames[i],null));
        }
    }

    static int buffer=50;
    static int index=0;
    String[] getSoundStrings()
    {
        
        Vector<String> send= new Vector<String>();
        int i=0;


        while(i<sounds.size())
        {
            if(sounds.get(i).mfccs == null)
            {
            send.add(sounds.get(i).filename);
            }
            i++;
            if(send.size()>=buffer)
                break;
        }       
        String[] ret = new String[send.size()];
        for(int k=0;k<send.size();k++)
        {
           ret[k] = send.get(k);
        }
        
        if(ret.length>0)
            return ret;
        else
            return null;
    }

    public void print()
    {
        for(int i=0;i<sounds.size(); i++)
        {
            System.out.print(sounds.get(i).filename);

            if(sounds.get(i).mfccs!=null)
            {
            for(int j=0;j<sounds.get(i).mfccs.length;j++)
               System.out.print("  "+sounds.get(i).mfccs[j]);
            }
            System.out.println();
        }
    }

    public Vector<double[]> getMFCCs()
    {
        Vector<double[]> ret = new Vector<double[]>();
        for(int i=0;i<sounds.size();i++)
        {
            ret.add(sounds.get(i).mfccs);
        }
        return ret;
    }

    public void setMFCCs(Vector<double[]> newMfccs)
    {
        for(int i=0;i<sounds.size();i++)
        {
            sounds.get(i).mfccs = newMfccs.get(i);
        }
    }
}
